<?php 

        // dialog pengalihan
        $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
            'id'=>'pengalihanDialog',
            // additional javascript options for the dialog plugin
            'options'=>array(
                'title'=>'Pengalihan Tamu',
                'autoOpen'=>false,
                'modal' => true,
                'width' => '500'
            ),
        ));

        
        $this->beginWidget('ext.widgets.XPanel', array( 'width' => 900,'height' => 500));
        
        $form   =   $this->beginWidget('ext.CAxActiveForm', array(
                            'id'=>'penerimaan-tamu-form',
                            'enableAjaxValidation'=>false,
                            'action' => Yii::app()->createUrl(
                                    'PenerimaanTamu/pengalihan',
                                    array(
                                        'id_penerimaan_tamu' => $PenerimaanTamu->id_penerimaan_tamu
                                    )
                                )
                    )); 
        ?>
        <table>
            <tr>
                <td><?php echo $form->labelEx($Meetingroom,'Nama Pegawai');?></td>
                <td>
                     <?php 
                            $this->widget('ext.jui.CustomAutoComplete',
                            array(
                            'model'=>new Pegawai,
                            'attribute'=>'nama',
                            'source'=>$this->createUrl('Pegawai/autocomplete'),
                            'htmlOptions'=>array('placeholder'=>'Nama Personal tujuan'),
                            'methodChain'=>'.data( "autocomplete" )._renderItem = function( ul, item ) {
                                return $( "<li></li>" )
                                    .data( "item.autocomplete", item )
                                    .append( "<a>" + item.label +  "<br/><span style=font-size:10px>"+ item.jabatan +"</span></a>" )
                                    .appendTo( ul );
                            };',
                            'options'=>
                                array(
                                    'mustMatch'=> TRUE,
                                    'showAnim'=>'fold',
                                    'select'=>"js:function(hotel, ui) {
                                        $('#PenerimaanTamu_id_pegawai').val(ui.item.id_pegawai);
                                        $('#Pegawai_nip').val(ui.item.nip);
                                        $('#Jabatan_nama').val(ui.item.jabatan);
                                        $('#Jabatan_id_jabatan').val(ui.item.id_jabatan);
                                        $('#unit').val(ui.item.struktur_organisasi);
                                        }"
                                        ),
                            'cssFile'=>false,
                            ));
                            echo $form->hiddenField(new Pegawai, 'id_pegawai');
                            echo $form->error(new Pegawai, 'id_pegawai');
                            ?>
                </td>
            </tr>
            
        </table>
        <?php
        
        echo CHtml::submitButton('Simpan', array('class'=>'ax-btn'));
        
        $this->endWidget(); //CAxActiveForm
        
        $this->endWidget(); //XPanel
        
        $this->endWidget('zii.widgets.jui.CJuiDialog'); //CJuiDialog

        // the link that may open the dialog
        echo " ".CHtml::button('pengalihan', array(
            'class' => 'ax-btn',
        'onclick'=>'$("#pengalihanDialog").dialog("open"); return false;',
        ));
        // dialog pengalihan
?>